package service;

import com.zjp.blog.data.model.Config;
import com.zjp.blog.service.ConfigService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * @author pj_zhong
 * @email pj_zhong@163.com / pj_zhong@gmail.com
 */

@ContextConfiguration("classpath:spring/application.xml")
@RunWith(SpringJUnit4ClassRunner.class)
public class ConfigServiceTest {

    @Autowired
    ConfigService configService;

    @Test
    public void test(){
       /* Config config = new Config();

        config.setKey("WebName");
        config.setValue("JP_ZHONG");

        configService.updateByKey(config);
*/
       /* for(Config config : configService.listAll()){
            System.out.print(config);
        }

        Config DoMain = new Config();
        DoMain.setKey("web_domain");
        DoMain.setValue("pjzhong.com");



        Config icp = new Config();
        description.setKey("web_icp");
        description.setValue("Empty");

        Config copyright = new Config();
        copyright.setKey("copyright");
        copyright.setValue("pj_zhong");

        configService.insertConfig(DoMain);

        configService.insertConfig(icp);
        configService.insertConfig(copyright);*/

        Config description = new Config();
        description.setKey("web_description");
        description.setValue("Try you best , make it great");

        configService.insertConfig(description);



       // configService.insertConfig(config);

       // Config webName = configService.getByKey(config.getKey());


       // System.out.print(webName);
    }
}
